<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CmModule extends Migrator
{

    public function change()
    {
        $table = $this->table('cm_module', ['auto_increment' => true, 'limit' => 10, 'signed' => false]);
        $table->addColumn('code', 'string', ['limit' => 4, 'default' => '', 'comment' => '功能编码（唯一）'])
            ->addColumn('name', 'string', ['limit' => 60, 'default' => '', 'comment' => '功能名称'])
            ->addColumn('limit_type_scope', 'string', ['limit' => 255, 'default' => '', 'comment' => '限定业务范围 空则不限定'])
            ->addColumn('describe', 'string', ['limit' => 150, 'default' => '', 'comment' => '说明'])
            ->addColumn('is_delete', 'integer', ['limit' => 10, 'default' => 0, 'signed' => false, 'comment' => '是否删除 0:否 非0:是'])
            ->addIndex(['code', 'is_delete'], ['type' => 'unique'])
            ->create();
    }
}
